package com.dd.logistics.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.beans.factory.InitializingBean;
import java.io.File;

@Data
@Configuration
@ConfigurationProperties(prefix = "upload")
public class UploadConfig implements InitializingBean {
    private String basePath;
    private String baseUrl;
    private long maxSize;
    private String allowedTypes;

    @Override
    public void afterPropertiesSet() throws Exception {
        // 创建上传根目录
        File directory = new File(basePath);
        if (!directory.exists()) {
            directory.mkdirs();
        }
    }

    // getter and setter methods
} 